home *** CD-ROM | disk | FTP | other *** search
- /* Boxing and unboxing. */
- using System;
-
- namespace Chapter2 {
- class Class1 {
- static void Main() {
- double Happy = 4.0;
-
- object MrBox = Happy;
-
- // This line should work well
- double StillHappy = (double)MrBox;
-
- // This line may compile, but it will surely fail on execution
- int NotHappy = (int)MrBox;
- }
- }
- }